package com.jasonzhou.onetomanycontrol.room

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.jasonzhou.onetomanycontrol.room.entity.AdjustColor
import com.jasonzhou.onetomanycontrol.room.entity.AdjustColorType

@Dao
interface AdjustColorDao {
    @Query("select * from  AdjustColor where color = (:color) and bright = (:bright) and type = (:type)")
    suspend fun findColorByColorAndBright(type: Int, color: Int, bright: Int): AdjustColor?

    @Query("select * from  AdjustColor where type = '${AdjustColorType.COLOR}'")
    suspend fun getAllColor(): List<AdjustColor>

    @Query("select * from  AdjustColor where type = '${AdjustColorType.WHITE}'")
    suspend fun getAllWhite(): List<AdjustColor>

    @Query("delete from adjustcolor where id = (:id)")
    suspend fun delColor(id: Long)

    @Insert
    suspend fun insertAll(vararg color: AdjustColor): List<Long>

    @Update
    suspend fun updateColor(vararg color: AdjustColor)
}